# Importing Data
JAPAN<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Plastic/Plastics.xlsx",sheet = "Sheet1", range = "b1:b70")

# Checking the Imported Data
View(JAPAN)
# Creating Time Series Data
JAPAN_ts <- ts(JAPAN, start=c(2006), end=c(2018), frequency=1)
# Viewing and Checking the Created Time Series Data
JAPAN_ts
sum(is.na(JAPAN_ts))
library(forecast)
JAPAN_ts <- tsclean(JAPAN_ts)
JAPAN_ts

# Identification: Plotting the Time Series Data
plot(JAPAN_ts)

# Estimating the appropriate model
JAPAN_ts_model <- auto.arima(JAPAN_ts)
JAPAN_ts_model

# Forecasting
options(max.print=1000000)
JAPAN_ts_forecast <- forecast (JAPAN_ts_model, level=c(95), h=22)
plot(JAPAN_ts_forecast)
JAPAN_ts_forecast             

# Exporting
write.table(JAPAN_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Plastic/JAPAN_TSA.csv", sep=",")


